export default class Stack {
    private items: any[];

    constructor() {
        this.items = []
    }

    push(item:any) {
        this.items.push(item)
    }

    pop() {
        return this.items.pop()
    }

    peek() {
        return this.items[this.items.length - 1]
    }
    isEmpty(): boolean {
        return this.items.length == 0
    }
    clear() {
        this.items = []
    }
    // find(item) {
    //     for(let i = 0; i < this.items.length; i++) {
    //         if(this.items[i] == item) {
    //             return i
    //         }
    //     }
    //     return -1;
    // }
    size(): number {
        return this.items.length
    }
    toString() {
        return this.items.join('')
    }
}
